package com.cloud.tsp.controller;

import com.cloud.api.domain.screen.HomeData;
import com.cloud.api.domain.screen.ScreenData;
import com.cloud.core.util.R;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.tsp.service.IScreenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;

/**
 * <p>
 *  首页和大屏数据接口
 * </p>
 *
 * @author haohaibo
 * @since 2024-02-28
 */
@RestController
@RequestMapping("/screen")
public class ScreenController {

    @Resource
    private IScreenService screenService;

    @Tag(name = "v1.0")
    @Operation(summary = "获取大屏数据接口")
    @PostMapping("/getScreenData")
    @Log(title = "大屏-获取大屏数据接口", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<ScreenData> getScreenData(){
        return R.ok(screenService.getScreenData());
    }

    @Tag(name = "v1.0")
    @Operation(summary = "获取首页数据接口")
    @PostMapping("/getHomeData")
    @Log(title = "大屏-获取首页数据接口", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<HomeData> getHomeData(){
        return R.ok(screenService.getHomeData());
    }
}
